package dynamic.adapter;

import com.baomidou.mybatisplus.core.MybatisPlusVersion;
import com.github.yulichang.adapter.base.tookit.VersionUtils;
import dynamic.adapter.base.DITableInfoAdapter;
import dynamic.metadata.DOrderFieldInfo;
import dynamic.metadata.DTableInfo;

import java.util.List;
import java.util.stream.Collectors;

public class DTableInfoAdapter3431 implements DITableInfoAdapter {

    private static final boolean v = VersionUtils.compare(MybatisPlusVersion.getVersion(), "3.4.3") < 0;

    @Override
    public List<DOrderFieldInfo> mpjGetOrderField(DTableInfo tableInfo) {
        return v ? null : tableInfo.getOrderByFields().stream().map(f ->
                new DOrderFieldInfo(f.getColumn(), f.getOrderByType(), f.getOrderBySort())).collect(Collectors.toList());
    }
}
